﻿namespace h2

{

    public class Employee

    {

        private int _id;

        private string _name;

        private int _age;

        private string _position;

        private double _salary;



        public Employee()

        {

        }



        public Employee(int id, string name, int age, string position, double salary)

        {

            _id = id;

            _name = name;

            _age = age;

            _position = position;

            _salary = salary;

        }



        public int Id

        {

            get { return _id; }

            set { _id = value; }

        }



        public string Name

        {

            get { return _name; }

            set { _name = value; }

        }



        public int Age

        {

            get { return _age; }

            set { _age = value; }

        }



        public string Position

        {

            get { return _position; }

            set { _position = value; }

        }



        public double Salary

        {

            get { return _salary; }

            set { _salary = value; }

        }

        public void DisplayInfo()

        {

            Console.WriteLine("员工信息:");

            Console.WriteLine($"ID: {Id}");

            Console.WriteLine($"姓名: {Name}");

            Console.WriteLine($"年龄: {Age}");

            Console.WriteLine($"职位: {Position}");

            Console.WriteLine($"薪资: {Salary:C}"); // 使用货币格式显示

            Console.WriteLine("------------------------");

        }

    }

    internal class Program

    {

        public static void Main(string[] args)

        {

            Employee emp1 = new Employee();

            emp1.Id = 1001;

            emp1.Name = "张三";

            emp1.Age = 30;

            emp1.Position = "软件工程师";

            emp1.Salary = 8000.0;



            Employee emp2 = new Employee(1002, "李四", 35, "项目经理", 12000.0);



            emp1.DisplayInfo();

            emp2.DisplayInfo();



            emp1.Salary = 8500.0;

            emp1.Position = "高级软件工程师";

            Console.WriteLine("修改后的员工1信息:");

            emp1.DisplayInfo();



            Console.WriteLine($"员工2的ID是: {emp2.Id}");

            Console.WriteLine($"员工2的姓名是: {emp2.Name}");

        }

    }

}

